package com.sanjiahantang.ythshopping.presenter;

import android.content.Context;

import com.sanjiahantang.ythshopping.config.ConfigValue;
import com.sanjiahantang.ythshopping.http.BaseDelegate;
import com.sanjiahantang.ythshopping.http.ExceptionHelper;
import com.sanjiahantang.ythshopping.http.OkHttpClientManager;
import com.sanjiahantang.ythshopping.model.ShareSqMsgModel;
import com.sanjiahantang.ythshopping.utils.Utils;
import com.sanjiahantang.ythshopping.views.ShareSqView;
import com.squareup.okhttp.Request;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by admin on 2017/7/30.
 */

public class ShareSQMsgPresenter extends BasePresenter {
    public ShareSqView sqview;
    Context context;
    ShareSqView view;

    public ShareSQMsgPresenter (Context context,ShareSqView view)
    {
        this.context=context;
        this.view=view;
    }

    public void LoadShareMsg()
    {
        Map<String,String> params=new HashMap();
        params.put("key", ConfigValue.DATA_KEY);
        OkHttpClientManager.postAsyn(context, ConfigValue.APP_IP + "share", params, new BaseDelegate.ResultCallback<ShareSqMsgModel>() {
            @Override
            public void onError(Request request, Object tag, Exception e) {
                Utils.showToast(context, ExceptionHelper.getMessage(e, context));
            }

            @Override
            public void onResponse(ShareSqMsgModel response, Object tag) {
             view.getShareMsg(response);
            }
        });
    }




}
